<template>
    <el-button v-bind="attr" :loading="loading" @click="onClick">
        <slot></slot>
    </el-button>
</template>
<script setup >
import { useAttrs, ref } from 'vue'
const attr = useAttrs();
const loading = ref(false);
const emit = defineEmits(['onClick']);

function onClick() {
    loading.value = true;
    emit('onClick');
    setTimeout(() => {
        loading.value = false;
    }, 1000);
}
</script>
<style scoped lang="scss"></style>
  